<template>
	<v-forms ref="formRef" :hideFooter="hideFooter">
		<template #tint1="scope">
			<el-Divider content-position="left" style="margin: 5px 0px"
				><span style="color: #1a63db; font-weight: bold">{{ scope.data.item.label }}</span></el-Divider
			>
		</template>
		<template #contract>
			<div v-if="contractURL">
				<el-icon size="12">
					<ele-Link />
				</el-icon>
				<a :href="`${$host}${contractURL}`" style="color: blue; text-decoration: underline" target="_blank">{{ $t('2q60GtaOAtU0Jcx1vJmf') }}</a>
			</div>
		</template>
	</v-forms>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { dataChangeFormConfig, VForms, demandApplyFormConfig, dataChangeDetailFormConfig, demandApplyDetailFormConfig } from '../config/index';
import { currentDay } from '/@/utils/hook/index';

let hideFooter = ref(false);
const formRef = ref();
let contractURL = ref(''); //附件地址
//新增数据变更
const addChangeDateNew = (data: any) => {
	hideFooter.value = false;
	data.date = currentDay;
	let list: any = dataChangeFormConfig(data);
	formRef.value.openDialog(list, window.$t('ln1H_9ebWf3cxGfvTlgoq'));
};
//新增需求申请
const addDemandApplyNew = (data: any) => {
	hideFooter.value = false;
	data.date = currentDay;
	let list: any = demandApplyFormConfig(data);
	formRef.value.openDialog(list, window.$t('f7cEpIrpPtPXuX2In2Vr'));
};
//查看数据变更明细
const detailChangeDate = (data: any) => {
	hideFooter.value = true;
	let list: any = dataChangeDetailFormConfig(data);
	contractURL.value = data.pictuctPath || '';
	formRef.value.openDialog(list, window.$t('uhVGsJepfMaIiiUqdSfz'));
};
//查看需求申请明细
const detailDemandApply = (data: any) => {
	hideFooter.value = true;
	let list: any = demandApplyDetailFormConfig(data);
	contractURL.value = data.pictuctPath || '';

	formRef.value.openDialog(list, window.$t('a3abA41fQ8x3vxbWqTqQl'));
};
defineExpose({
	addChangeDateNew,
	addDemandApplyNew,
	detailChangeDate,
	detailDemandApply,
});
</script>
<scope lang="scss" scoped></scope>
